package com.bdqn.boot.yuanshen.service.impl;

import com.bdqn.boot.yuanshen.mapper.FollowsMapper;
import com.bdqn.boot.yuanshen.service.FollowsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author 周宏锦
 * @Description 关注表的业务逻辑层接口的实现
 * @Date 2025/4/7 19:14
 * @Version 1.0
 */
@Service
public class FollowsServiceImpl implements FollowsService {
    @Autowired
    private FollowsMapper followsMapper;

    public Map<String, Object> getFollowerAndFollowedCount(Integer userId) {
        Map<String, Object> result = new HashMap<>();
        // 查询粉丝数
        Integer followerCount = followsMapper.getFollowerCount(userId);
        // 查询关注数
        Integer followedCount = followsMapper.getFollowedCount(userId);

        result.put("followerCount", followerCount);
        result.put("followedCount", followedCount);
        return result;
    }
}

